package objects;

public class Message {
	User owner;
	String message;
	String title;
	public Message(User owner, String message) {
		super();
		this.owner = owner;
		this.message = message;
		int tmp =this.message.lastIndexOf('\n');
		if (tmp==-1)
		{
			title="";
			return;
		}
		this.title= this.message.substring(tmp);
		this.message=this.message.substring(0, tmp);
		
	}
	/**
	 * @return the owner
	 */
	public User getOwner() {
		return owner;
	}
	/**
	 * @param owner the owner to set
	 */
	public void setOwner(User owner) {
		this.owner = owner;
	}
	/**
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}
	/**
	 * @param message the message to set
	 */
	public void setMessage(String message) {
		this.message = message;
	}
	
	public String getTitleOfMessage ()
	{
		return title;
		
	}
	
	@Override
	public String toString()
	{
		return message;
	}
	
	
}
